//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    list: [{
      "text": "首页",
      "iconPath": "/common/image/home.png",
      "selectedIconPath": "/common/image/homes.png",
  },
  {
      "text": "我的",
      "iconPath": "/common/image/member.png",
      "selectedIconPath": "/common/image/members.png",
  }],
  code:"",
  list:[]
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {

  },
  onShow:function()
  {
   var that=this
   var code=""
   that.getAllWenzhang(code)

  },

  //获取所有文章
  getAllWenzhang:function(code)
  {
    var that=this
        wx.request({
            url:app.data.service_url + 'wenzhang/getByCode',
            data: {
               code:code
            },
            method:"POST",
            header:{
              "Content-Type": "application/x-www-form-urlencoded"
               },  
               success(res)
               {
        console.log("---------------------------------------")
                 console.log(res)
        that.setData({
          list:res.data
        })
    
               }
          })
    

  },
  onChange:function(e)
  {
     var that=this
     console.log(e)
     var code=e.detail
     console.log(code) 
     that.getAllWenzhang(code)

  },
  tabChange(e) {
    var url = e.detail.index == 1?'/pages/member/member':'/pages/index/index'
    wx.navigateTo({
      url: url,
    })
  }
})
